package com.lq.demo.demo.mode.aop;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 *  这个简单的controller用来演示aop的
 */
@RestController
@RequestMapping("/demo/user")
public class UserController {
    @Value("${limitCount}")
    public   int count;

    @GetMapping("/{id}")
    public String demo1(@PathVariable( "id") String id) {
        System.out.println("  do  somethng ");
        return id;
    }

    @Auth(value = "role")
    @GetMapping("/get")
    public String demo2(String id) {
        //模拟异常
        int i=1/0;
        System.out.println("  do  somethng2 ");
        return id;
    }
}
